<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html lang="zh-cn" style="height: 100%">
<base href="<%=basePath%>">
">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <title>违章信息</title>
    <link rel="stylesheet" href="css/base.css">
    <style type="text/css">
        .handle_result_table tr td {
            line-height: 30px;
            /*background-color:#000000;*/
        }

        .handle_result_table {
            padding: 0 10px;
        }
    </style>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/base.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/handle.js"></script>
    <script type="text/javascript" src="js/sha256.js"></script>
    <script type="text/javascript" src="js/sig.js"></script>
</head>
<body class="">
<div class="wrap">
    <div class="handle_result recharge_result">
        <h2>违章信息</h2>
        <div class="handle_result_box">
            <h3 class="border_e5"><i class="result_card_icon"></i>
                <span id="vehiclePlate"></span>
            </h3>
            <table class="handle_result_table">
                <tbody>
                <tr>
                    <td>文书编号</td>
                    <td><span id="archiveno"></span></td>
                </tr>

                <tr>
                    <td>违章时间</td>
                    <td><span id="date"></span></td>
                </tr>
                <tr>
                    <td>违章地点</td>
                    <td><span id="area"></span></td>
                </tr>
                <tr>
                    <td>违章城市</td>
                    <td><span id="wzcity"></span></td>
                </tr>
                <tr>
                    <td>违章扣分</td>
                    <td><span id="fen"></span></td>
                </tr>
                <tr>
                    <td>违章罚款</td>
                    <td><span id="money"></span></td>
                </tr>
                <tr>
                    <td>违章行为</td>
                    <td><span id="act"></span></td>
                </tr>
                <tr>
                    <td>是否处理</td>
                    <td><span id="result"></span></td>
                </tr>
                </tbody>
            </table>
        </div>

    </div>
</div>
<div class="mask_layer none"></div>
<div class="toast toast_timeout" style="display:none">网络异常，请稍后重试！</div>
<div class="toast toast_error" style="display:none">信息输入有误</div>
<div class="loading" style="display:none">
    <img src="img/loading.gif"></div>
</body>
<script type="text/javascript">
    var fromUser = "${memberNum}";
    var wzId = "${wzId}";
    $(function () {
        getWzInfo(wzId);
        if ("${share}" == 1) {
            alert_LHX({
                hasBtn: 1,
                msg: '点击右上角可分享违章信息给他人'
            });
        }
        $("#goToTransfer").click(function (e) {

        });
    })

    function getWzInfo(id) {
        $(".loading").show();
        $.ajax({
            url: $.httpRootPath() + 'rest/driver/wz/info/' + id,
            type: 'GET',
            dataType: 'json',
            timeout: 15000,
            success: function (r) {
                console.log(r)
                $(".loading").hide();
                if (r.code == "00") {
                    var obj = r.data;
                    if (r.code == '00') {

                        $("#date").html(obj.date);
                        $("#area").html(obj.area);
                        $("#wzcity").html(obj.wzcity);
                        $("#fen").html(obj.fen);
                        $("#money").html(obj.money);
                        $("#act").html(obj.act);
                        $("#archiveno").html(obj.archiveno);
                        $("#vehiclePlate").html(obj.vehiclePlate);
                        var resStr = "";
                        if (obj.handled == '0') {
                            resStr = "<span style='color: red'>未处理<span>"
                        }else {
                            resStr = '已处理';
                        }
                        $("#result").html( resStr);
                    }
                } else {
                    alert_LHX({
                        hasBtn: 0,
                        msg: '获取信息失败，请重试'
                    });
                }
            },
            error: function (e) {
                $(".loading").hide();
                ajaxErrorEvent(e);
            }
        });
    }
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="js/weixin.js"></script>
<script type="text/javascript">
    var jsApiList = ['onMenuShareAppMessage'];
    $(function () {
        getSignature(jsApiList, function () {
            var title = $("#vehiclePlate").text() + " 扣分提醒";
            var desc = $("#fen").text() + "分" + $("#money").text() + "元" + '\n'
                + $("#date").text() + "\n"
                + $("#act").text();
            fromUser = fromUser == "" ? GetQueryString("fromUser") : fromUser;
            var imgUrl = $.httpStaticPath() + 'common/icon/wz.png';
            var link = $.httpRootPath() + 'driver/wz/info?id=' + wzId + '&fromUser=' + fromUser;

            wx.onMenuShareAppMessage({
                title: title, // 分享标题
                desc: desc, // 分享描述
                link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                imgUrl: imgUrl, // 分享图标
                type: 'link', // 分享类型,music、video或link，不填默认为link
                success: function () {
                    // 用户确认分享后执行的回调函数
                    var data = {
                        fromPage: location.href,
                        fromUser: fromUser,
                        shareType: "onMenuShareAppMessage",
                        content: title,
                    };
                    addShareRecord(data);
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
        })
    })

</script>
</html>